<template>
   <div class="list">
      <dl v-for="v in list" :key="v.id" @click="toDetail(v.id)">
        <dt><img :src="v.url" alt=""></dt>
        <dd>
          <h3>{{ v.title }}</h3>
          <p>{{ v.price }}</p>
        </dd>
      </dl>
    </div>
</template>


<script>
export default {
  methods: {
     toDetail(id) {
      this.$router.push({ name: 'detail', params: { id } })
      // this.$router.push(`/detail/${id}`)
    }
  },
  props: {
    list: {
      type: Array,
      require: true
    }
  }
}
</script>

<style scoped lang="scss">
.list {
  display: flex;
  padding: 10px;
  flex-wrap: wrap;
  dl {
    width: 50%;
    padding: 10px;
    flex-shrink: 0;
    // background: rgba(66, 59, 60, 0.52);
    dt {
      padding: 10px;
      img {
        width: 100%;
      }
    }

    dd {
      p {
        color: red;
      }
    }
  }
}
</style>